<?php
/**
 * @author guoxiaoyong
 */
namespace bc\wx;

use bc\util\Util;

class User
{
	
	/**
	 * 获取用户信息，只有snsapi_userinfo模式才有效
	 * 
	 * @param string $accessToken 
	 * @param string $openId
	 * @return array
	 */
	public function getUserInfo($accessToken, $openId)
	{
		$params ['access_token'] = $accessToken;
		$params ['openid'] = $openId;
		$params ['lang'] = 'zh_CN';
		$url = 'https://api.weixin.qq.com/cgi-bin/user/info';
		$rs = json_decode ( Util::httpGet ( $url, $params ), true );
		return $rs;
	}

	public function getBatchUserInfo($accessToken,$dataj)
	{
		//$params ['access_token'] = $accessToken;
		$url = 'https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token='.$accessToken;
		$rs = json_decode ( Util::httpPost( $url, $dataj ), true );
		return $rs;
	}
}

